<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/1/28
  Time: 19:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <title>图书馆座位预约系统</title>
  <link rel="icon" href="favicon.ico" type="image/ico">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/materialdesignicons.min.css" rel="stylesheet">
  <link href="css/style.min.css" rel="stylesheet">
  <link href="css/login.css" rel="stylesheet">
  <script src="js/jquery.min.js"></script>
  <script src="js/Customize/login.js"></script>
</head>
<body style="background-image: url(img/loginbg2.jpg); background-size: cover;">
<%
  //获得所有cookie信息
  Cookie[] cs=request.getCookies();

  //声明变量存记住用户名和密码
  String uname2=null;
  String pwd2=null;
  if (cs!=null){
    //遍历cookie数组
    for (Cookie c:cs){
      //判断当前cookie的Key名,通过Key名判断当前cookie存的是否是用户名或密码
      if (c.getName().equals("uname1")){
        uname2=c.getValue();
      }else if (c.getName().equals("pwd1")){
        pwd2=c.getValue();
      }
    }
  }
%>

<div class="bg-translucent p-10">
  <div class="login-box bg-white clearfix">
    <div class="login-left">
      <p align="center">图书馆座位预约系统</p>
      <form action="common" method="post">
        <div class="form-group has-feedback feedback-left">
          <input type="text" placeholder="请输入您的用户名" class="form-control" onblur="isUser()" id="username" value="<%=uname2==null?"":uname2 %>"/>
          <span class="mdi mdi-account form-control-feedback" aria-hidden="true"></span>
        </div>
        <div class="form-group has-feedback feedback-left">
          <input type="password" placeholder="请输入密码" class="form-control" onblur="isPassword()" id="password"  value="<%=pwd2==null?"":pwd2 %>"/>
          <span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
        </div>
        <div class="form-group has-feedback feedback-left">
          <select  class="form-control" name="level" id="level">
            <option value="1">普通用户</option>
            <option value="2">员工</option>
            <option value="3">管理员</option>
          </select>
          <span class="mdi  mdi-apple form-control-feedback" aria-hidden="true"></span>
        </div>
        <div class="form-group has-feedback feedback-left row">
          <div class="col-xs-7">
            <input type="text" name="captcha" id="captchaInput" onblur="Test1()" class="form-control"  placeholder="验证码">
            <span class="mdi mdi-check-all form-control-feedback" aria-hidden="true"></span>
          </div>
          <div class="col-xs-5">
            <img src="Code/getCode.action?A=1" class="pull-right" id="captcha" style="cursor: pointer;" onclick="refresh()" title="点击刷新" alt="加载失败">
          </div>
        </div>
        <div class="form-group">
          <label class="lyear-checkbox checkbox-primary m-t-10">
            <input type="checkbox"  id="remenberMe"><span>记住我</span>
          </label>
          <p id="mess"></p>
        </div>
        <div class="form-group">
          <button id="login" onclick="Login()" type="button" class="btn btn-block btn-primary">登录</button>
        </div>
      </form>
      <a class="btn btn-block btn-primary" href="register.jsp">注册</a>
    </div>
  </div>
</div>
</body>
</html>